package com.singzi.leetcode.N200;



public class T0103 {
    public static void main(String[] args) {
        TreeNode treeNode = new TreeNode();
        Solution0103 solution0103 = new Solution0103();
        System.out.println(solution0103.maxDepth(treeNode));
    }

}
class Solution0103 {
    public int maxDepth(TreeNode root) {
        if(root == null) return 0;
        int maxLeft = maxDepth(root.left);
        int maxRight = maxDepth(root.right);

        return Math.max(maxLeft, maxRight)+1;

    }
}

class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;
    TreeNode() {}
    TreeNode(int val) { this.val = val; }
    TreeNode(int val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;
    }
}
